// 接受邀请
import { navigation } from '../../../../../utils/commons'

Page({

    data: {
        name: '',
        id: '',
        msgId: '',
        sessionID: ''
    },

    onLoad(options) {
        this.setData({
            sessionID: wx.getStorageSync('sessionID'),
            name: options.name,
            id: options.id,
            msgId: options.msgId
        })
    },

    // 点击确认按钮触发的事件
    gotoMessage(e) {
        wx.request({
            url: 'https://www.hschuangsai.com/message/reply',
            header: {
                "session": this.data.sessionID,
            },
            data: {
                "id": this.data.msgId,
                "reason": "",
                "status": "ACCEPT"
            },
            method: "POST",
            success: (res) => {
                wx.switchTab({
                    url: '../../../account'
                });
            }
        })
    },

    gotoDetail(e) {
        navigation('../invitation?idOfPrg=' + this.data.id);
    }
})